home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Palm Pilot Collection
/
Palm Pilot Collection (Explore the World of Software) (1998).iso
/
apps
/
weather2.exe
/
grabwthr.bat
< prev
next >
Wrap
DOS Batch File
|
1997-12-24
|
9KB
|
201 lines
REM -- This is GRABWTHR.BAT
rem -- POINTCAST VERSION 1 USERS:
rem -- ==========================
rem -- PointCast version 1. keeps its weather files in a subfolder called
rem -- "weather" in a file called "wcity2.lst". So to use that version
rem -- of PointCast, you would:
rem -- First, edit the following line so that it specifies whatever
rem -- folder PointCast is set up in on your system,
rem -- then second, strip off the "REM --" in front of the line.
rem -- That should do it.
rem ---------------------USER MODIFIABLE---------------------
rem -- copy "C:\Program Files\PointCast\weather\wcity2.lst" wthrcopy.tmp
rem ---------------------USER MODIFIABLE---------------------
rem -- POINTCAST VERSION 2 USERS:
rem -- ==========================
rem -- PoinCast version 2 changes the file name each time it gets
rem -- the weather, but the folder seems constant, and the file
rem -- name appears always to start with "4" and contain five digits.
rem -- So the line below has worked for me through several weeks
rem -- of testing, though I can't guarantee that it will always work.
rem -- In any event, if you are using PointCast version 2., do this:
rem -- First, edit the following line so that it specifies whatever
rem -- folder PointCast is set up in on your system,
rem -- then second, strip off the "REM --" in front of the line.
rem -- That should do it until PointCast fools us all with another change.
rem ---------------------USER MODIFIABLE---------------------
copy "C:\Program Files\PointCast 2.0\lcm\0\4????.dat" wthrcopy.tmp
rem ---------------------USER MODIFIABLE---------------------
rem -- Extract current date from PREAMBLE line and create wther.tmp
mt /xqon+ wthrcopy.tmp / "^(PREAMBLE,.*\d{9},\".*\")" = "\5\r\n\t\tHi\tLo\tConditions\r\n\t\t--\t--\t----------\r\n" >wthr.tmp
rem -- Change case of AM and PM just because I like it better
rem -- and delete the "Eastern" time label
mt /xqn+ wthr.tmp / "AM" = " am" "PM" = " pm" "\sEastern" = \z
rem -- HERE IS WHERE YOU CAN SPECIFY A FULL NAME+STATE IF YOU
rem -- WANT TO. THIS IS ALSO USEFUL FOR CITIES (LIKE WHERE
rem -- LIVE) THAT YOU MIGHT ALWAYS WANT INCLUDED IN THE OUTPUT DOC FILE.
rem -- Note that the city name must begin with one leading
rem -- quote, and the two letter state abbreviation must
rem -- be followed by period-asterisk-dollarsign-quote.
rem -- Cities outside the U.S. do not have a "state" or even
rem -- a "country" specification--you just use the city name.
rem -- Here some sample cities: if you want the weather for any
rem -- of them, just strip off the "REM -- " at the beginning of
rem -- the line. Or edit any of the lines to put in another
rem -- city of your choice.
mt /xoqn+ wthrcopy.tmp / "^(L,\"Williamsburg, VA.*$" = "\i" >>wthr.tmp
rem ---------------------USER MODIFIABLE---------------------
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Baton Rouge, LA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Honolulu, HI.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Las Cruces, NM.*$" = "\i" >>wthr.tm
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Las Vegas, NV.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Los Angeles, CA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"New York (JFK), NY.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"New York (LGA), NY.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"New Orleans, LA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Richmond, VA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Saginaw, MI.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"San Angelo, TX.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"San Antonio, TX.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"San Diego, CA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"San Francisco, CA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"San Jose, CA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"San Juan, PR.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"San Luis Obispo, CA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Santa Barbara, CA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Santa Fe, NM.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Santa Maria, CA.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Texarkana, AR.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Montreal.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Ottawa.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Quebec.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Vancouver.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Casablanca.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Nairobi.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Ho Chi Minh City.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Hong Kong.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Nanjing.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Tokyo.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Seoul.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Adelaide.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Melbourne.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Havana.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Athens.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Mexico City.*$" = "\i" >>wthr.tmp
rem -- mt /xoqn+ wthrcopy.tmp / "^(L,\"Rio de Janeiro.*$" = "\i" >>wthr.tmp
rem ---------------------USER MODIFIABLE---------------------
rem -- Here is where this batch file picks up the city names
rem -- that have been passed as parameters from the CITYLIST.BAT file.
if (%1) == () goto NEXT
mt /xoqn+ wthrcopy.tmp / "^(L,\"%1.*$" = "\i" >>wthr.tmp
if (%2) == () goto NEXT
mt /xoqn+ wthrcopy.tmp / "^(L,\"%2.*$" = "\i" >>wthr.tmp
if (%3) == () goto NEXT
mt /xoqn+ wthrcopy.tmp / "^(L,\"%3.*$" = "\i" >>wthr.tmp
if (%4) == () goto NEXT
mt /xoqn+ wthrcopy.tmp / "^(L,\"%4.*$" = "\i" >>wthr.tmp
if (%5) == () goto NEXT
mt /xoqn+ wthrcopy.tmp / "^(L,\"%5.*$" = "\i" >>wthr.tmp
if (%6) == () goto NEXT
mt /xoqn+ wthrcopy.tmp / "^(L,\"%6.*$" = "\i" >>wthr.tmp
if (%7) == () goto NEXT
mt /xoqn+ wthrcopy.tmp / "^(L,\"%7.*$" = "\i" >>wthr.tmp
if (%8) == () goto NEXT
mt /xoqn+ wthrcopy.tmp / "^(L,\"%8.*$" = "\i" >>wthr.tmp
if (%9) == () goto NEXT
mt /xoqn+ wthrcopy.tmp / "^(L,\"%9.*$" = "\i" >>wthr.tmp
:NEXT
rem -- For some reason some of the line breaks
rem -- at this point have two CRs and one LF, so fix it:
mt /xqn+ wthr.tmp / "\r\r\n" = "\r\n"
rem -- Now decode the weather forecast codes
mt /xqn+ wthr.tmp / ",0,)" = "\tSunny\r\n"
mt /xqn+ wthr.tmp / ",1,)" = "\tFair\r\n"
mt /xqn+ wthr.tmp / ",2,)" = "\tPartly Cloudy\r\n"
mt /xqn+ wthr.tmp / ",3,)" = "\tMostly Cloudy\r\n"
mt /xqn+ wthr.tmp / ",4,)" = "\tCloudy\r\n"
mt /xqn+ wthr.tmp / ",5,)" = "\tT-Storms\r\n"
mt /xqn+ wthr.tmp / ",6,)" = "\tWindy\r\n"
mt /xqn+ wthr.tmp / ",7.)" = "\tRain\r\n"
mt /xqn+ wthr.tmp / ",8,)" = "\tShowers\r\n"
mt /xqn+ wthr.tmp / ",9,)" = "\tSnow\r\n"
mt /xqn+ wthr.tmp / ",10,)" = "\tFlurries\r\n"
mt /xqn+ wthr.tmp / ",18,)" = "\tFreezing Rain\r\n"
mt /xqn+ wthr.tmp / "'(-1,,,'-?\d{1,3},-?\d{1,3}" = "...yda\t\2\3\t\5\6"
mt /xqn+ wthr.tmp / "'(0,,,'-?\d{1,3},-?\d{1,3}" = "TODAY\t\2\3\t\5\6"
mt /xqn+ wthr.tmp / "'(1,,,'-?\d{1,3},-?\d{1,3}" = "Tmro\t\2\3\t\5\6"
mt /xqn+ wthr.tmp / "'(2,,,'-?\d{1,3},-?\d{1,3}" = "Next\t\2\3\t\5\6"
mt /xqn+ wthr.tmp / "'(3,,,'-?\d{1,3},-?\d{1,3}" = "After\t\2\3\t\5\6"
rem -- Delete the stuff surrounding city names and insert
rem -- special characters for a DOC bookmark.
rem -- I use three spaces as the bookmark because it
rem -- looks better on screen than two. But YMMV.
rem -- They don't even have to be spaces, for that matter.
mt /xqn+ wthr.tmp / "^(L,\".*\")" = " \2\r\n"
rem -- Add the DOC "autobookmark" indicator: whatever appears
rem -- at the end of the file between angle brackets is treated
rem -- by DOC as an autobookmark indicator. I put the actual
rem -- text in a separate file so I can include the spaces.
type autobook.txt >>wthr.tmp
rem -- And convert to DOC format with MAKEDOC.EXE
makedoc wthr.tmp wthr.pdb Weather
rem -- If you have a batch install program
rem -- you can install the WTHR.PDB file right now.
rem -- I use PINSTALL.EXE
rem ---------------------USER MODIFIABLE---------------------
..\pinstall wthr.pdb
rem ---------------------USER MODIFIABLE---------------------
rem -- Now clean up a bit
rem ---------------------USER MODIFIABLE---------------------
rem -- del *.tmp
rem -- del wthr.pdb
rem ---------------------USER MODIFIABLE---------------------
rem -- That's it!
:END